package com.zy.is.common.config;

import com.zy.is.common.properties.AppProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @ClassName: WebMvcConfiguration
 * @Description: web配置
 * @Author: Yanzy
 * @Data: 2021/4/14 15:01
 * @Source: 1.0
 */
@Configuration
public class WebMvcConfiguration implements WebMvcConfigurer {

    @Resource
    private AppProperties appProperties;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 本地文件上传路径
        registry.addResourceHandler(AppConstants.ACCESS_PATH + "/**").addResourceLocations("file:" + appProperties.getFilePath() + "/");
    }
}
